package withdraw

import (
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/schema"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/rpc"
)

const TableNameWithdrawType = "withdraw_type"

const (
	WithdrawTypeStatusOpen  = 1
	WithdrawTypeStatusClose = 2
)

func ProtoStatusToConst(status rpc.WithdrawStatus) int32 {
	switch status {
	case rpc.WithdrawStatus_Open:
		return WithdrawTypeStatusOpen
	case rpc.WithdrawStatus_Close:
		return WithdrawTypeStatusClose
	}

	return 0
}

// WithdrawType 提现类型
type WithdrawType struct {
	schema.Model
	WithdrawID     int32   `gorm:"type:int;not null;comment:会员等级"`
	SelectedIcon   string  `gorm:"type:varchar(1024);not null;comment:选中后图标"`
	UnselectedIcon string  `gorm:"type:varchar(1024);not null;comment:选中前图标"`
	Type           int32   `gorm:"primaryKey;type:tinyint;not null;comment:渠道类型,1Bank,2Ewallet,3LocalEwallet,4PixWallets,5UsdtWallets"`
	DailyTimes     int32   `gorm:"type:int;not null;comment:日总提现次数"`
	CurTimes       int32   `gorm:"type:int;not null;comment:当日剩余提现次数"`
	BeginningOfDay int64   `gorm:"type:int;not null;comment:当日提现开始时间"`
	MinAmount      float64 `gorm:"type:decimal(20,4);not null;comment:最小金额"`
	MaxAmount      float64 `gorm:"type:decimal(20,4);not null;comment:最大金额"`
	FeeRate        float64 `gorm:"type:decimal(20,4);not null;comment:手续费率"`
	WithdrawTime   string  `gorm:"type:varchar(50);not null;comment:提现时间"`
	Status         int32   `gorm:"type:tinyint;not null;comment:状态1:打开"`
	Sort           int32   `gorm:"type:int;not null;comment:优先级"`
	FromCion       string  `gorm:"type:varchar(20);not null;comment:输入币种名称"`
	ToCion         string  `gorm:"type:varchar(20);not null;comment:输出币种名称"`
}

func (*WithdrawType) TableName() string {
	return TableNameWithdrawType
}
